package com.spring.boot.springBoot.manyDataSource;

import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * Created by pactera on 2018/1/12.
 */
@Configuration
public class DruidDataSourceConfig {


    @Primary
    @Bean
    @ConfigurationProperties("spring.datasource.first")
    public DataSource spitDataSource(){
        return DataSourceBuilder.create().build();
    }

    @Bean
    @ConfigurationProperties("spring.datasource.secend")
    public DataSource  pacteraDataSource(){
        return DataSourceBuilder.create().build();
    }
}
